<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/DetailTemplate.master" Inherits="System.Web.Mvc.ViewPage<DotNetBurner.StoryDetailData>" %>
<%@ Import Namespace="DotNetBurner" %>
<%@ Import Namespace="Resources" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContentPlaceHolder" runat="server">
<% var story = ViewData.Model.Story; %>
<% string voteCountId = "voteCount" + story.StoryId;%>
<% string voteId = "vote" + story.StoryId;%>
<table class="story">
    <tbody>
        <tr>
            <td class="vote">
                <div class="count">
                    <div id="<%=voteCountId %>"><%=Html.GetVoteImages (story.VoteCount)%></div>
                    <div class="text"><%=(story.VoteCount <= 1) ? Strings.OneVote : Strings.Votes%></div>
                </div>
                <%=Html.StoryVoteLink(story.HasVoted, story.StoryId, story.VoteCount)%>
            </td>
            <td class="content">
                <div class="title">
                    <h1><a href="<%= story.Url.AttributeEncode()%>" onclick="javascript:Story.click(<%=story.StoryId%>);" target="_blank" title="<%=story.Title.AttributeEncode()%>"><%=story.Title.HtmlEncode ()%></a></h1>
                </div>
                <% if (PageGlimpseSettings.Settings.Enabled)
                   { %>
                    <div class="thumbnail-detail">
                        <%=Html.Thumbnail(story)%>
                    </div>
                <%} %>
                <div class="description">
                    <p>
                        <% string domainUrl = story.Url.ExtractDomainNameFromURL (); %>
                        <span class="link"><a href="<%=story.Url.ExtractSiteFromURL()%>" target="_blank" title="<%=domainUrl%>"><%=domainUrl%></a></span> - 
                        <%=story.Description.HtmlEncode().NewLine2Br()%>
                    </p>
                </div>
                <div class="summary">
                    <span class="category"><%=Html.RouteLink(story.CategoryName, "Category", new RouteValueDictionary{{"id", story.CategoryId}, {"name", story.CategoryName.ConvertToUrlPath ()}, {"page",  1}})%></span>
                    <%if (ViewData.Model.UserCanEditStory)
                      { %>
                        <span class="edit">
                            <%=Html.RouteLink(Strings.EditStory, "Edit", new RouteValueDictionary {{"id", story.StoryId }})%>
                        </span>
                    <%} %>
                    <%if (ViewData.Model.UserIsAdm)
                      { %>
                        <span class="delete">
                            <a href="#" onclick="javascript:$('#delForm').fadeIn(500)" title="<%=Strings.DeleteStory%>"><%=Strings.DeleteStory%></a>
                        </span>
                    <%} %>
                </div>
                <span class="tags">
                    <%=Strings.Tags.ToLower()%>:
                    <%=Html.StoryTagsLinks(story.Tags)%>
                </span>
            </td>
            <td class="postedby">
                <table cellpadding="2" cellspacing="0" border="0">
                <tr>
                    <td>
                        <%=Html.Gravatar (story.PostedByUser.Email, 60)%>
                    </td>
                    <td>
                        <div class="timestamp">
                            <%=Strings.PostedBy%>
                            <a href="<%= Url.RouteUrl("PostedBy", new RouteValueDictionary{{"id", story.PostedByUser.UserId}, {"name", story.PostedByUser.Name.ConvertToUrlPath()}, {"page", 1}})%>"><%=story.PostedByUser.Name.HtmlEncode ()%></a><br />
                            <span class="time"><%= story.PostedAgo%></span> <%=Strings.ago%>.
                        </div>
                    </td>
                </tr>
                </table>
            </td>
        </tr>
    </tbody>
</table>
<% if (ViewData.Model.UserIsAdm) Html.RenderPartial("DeleteStory", ViewData.Model);%>

<div  id="detail-left">
    <%Html.RenderPartial("RelatedStories", ViewData.Model);%>
    <%Html.RenderPartial("VotedBy", ViewData.Model);%>
    <div class="divider"></div>
    <%Html.RenderPartial("Comments", ViewData.Model);%>
</div>
<div id="detail-right">
    <%Html.RenderPartial("TopStoriesInCategory", ViewData.Model);%>
</div>
<br style="clear: both" />
</asp:Content>